/*
 * ElementSerializationTest.cpp

 *
 */

#include "ElementSerializationTest.h"

#include "../../src/logical_layer/bplustree/Element.h"
#include "../../src/logical_layer/bplustree/ElementFactory.h"
#include <assert.h>
#include <string>

using namespace std;
ElementSerializationTest::ElementSerializationTest() {
}

ElementSerializationTest::~ElementSerializationTest() {
}

void ElementSerializationTest::run()
{

	Element* elem=ElementFactory::createElement(ELEMENT,1,"5aaaa",6);


	Element* serializedElement=ElementFactory::createElement(ELEMENT);
	string unserialize=elem->serialize();
	serializedElement->unserialize(unserialize);

	assert( (elem->getKey()==serializedElement->getKey()));
//	cout<<serializedElement->getData()<<endl;
	assert( !(strcmp(elem->getData(),serializedElement->getData())));

//	cout<<elem->getData()<<endl;

	delete serializedElement;
	delete elem;
	cout<<"ElementSerializationTest     OK"<<endl;
}


